﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using VNet.VisiSuite.Common.Production;
using VNet.VisiSuite.Service.Contact.Message.ProductionData;

namespace VNet.VisiSuite.Controls
{
    /// <summary>
    /// Interaction logic for PlanMetrics.xaml
    /// </summary>
    public partial class PlantMetrics : UserControl, INotifyPropertyChanged
    {
        #region Private Variables
        #endregion

        #region Dependencies

        public static readonly DependencyProperty PlantMetricsDataProperty = DependencyProperty.Register("PlantMetricsData", typeof(PlantMetricsDataItem), typeof(PlantMetrics), new FrameworkPropertyMetadata(null, PlantMetricsDataChangedCallback));

        public PlantMetricsDataItem PlantMetricsData
        {
            get { return GetValue(PlantMetricsDataProperty) as PlantMetricsDataItem; }
            set {
                SetValue(PlantMetricsDataProperty, value); 
                OnPropertyChanged("PlantMetricsData");
            }
        }

        private static void PlantMetricsDataChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            var ctrl = d as PlantMetrics;
            var data = e.NewValue as PlantMetricsDataItem;
            //ctrl.PlantMetricsData = data;
        }

        public static DependencyProperty LegendProperty = DependencyProperty.Register("Legend", typeof(List<ProductionMeterGraphLegend>), typeof(PlantMetrics));

        public List<ProductionMeterGraphLegend> Legend
        {
            get { return (List<ProductionMeterGraphLegend>)GetValue(LegendProperty); }
            set { SetValue(LegendProperty, value); }
        }

        #endregion

        #region Implement INotifiedPropertyChanged

        public event PropertyChangedEventHandler PropertyChanged;

        protected virtual void OnPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }

        #endregion

        public PlantMetrics()
        {
            InitializeComponent();
        }
    }
}
